// 示例：为当前场次上报玩家扩展字段（score/hp/kda）
import { LiveEvent, LiveUpdater, type LiveUpdatePlayer } from '../App';

// 创建 LiveUpdater 实例
const updater = new LiveUpdater({ key: 'demo_player_extras' });
async function pushPlayerExtrasDemo() {
  const live = LiveEvent.getInstance();
  await live.useTestData(true);

  const cur = live.getCurrentMatch();
  if (!cur) {
    console.log('无当前比赛，跳过');
    return;
  }

  // 从当前上场玩家构造扩展字段（示例数据，接入时替换为你们地图的实时值）
  const refs = live.getCurrentMatchPlayerRefs();
  const extras: Record<number, Partial<LiveUpdatePlayer>> = {};
  for (const p of refs) {
    extras[p.id] = { score: 12, hp: 88, kda: '2/1/3' };
  }

  const ok = await updater.pushFromMatch(cur, { teamA: 10, teamB: 9 }, extras);
  console.log('[pushPlayerExtrasDemo] 结果:', ok ? '成功' : '失败');
}

pushPlayerExtrasDemo().catch(console.error);
